<!DOCTYPE html>

<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="/socket.io/socket.io.js"></script>
	<script type="text/javascript">
		var chat = io.connect('http://localhost:1337/chat');
		var news = io.connect('http://localhost:1337/news');

		chat.on('connect', function(){
			chat.send('你好');
			chat.on('message', function(msg) {
				console.log('从chat命名空间接收到消息: ' + msg);
			});
		});

		news.on('connect', function(){
			news.emit('send message', '你好');
			news.on('send message', function(msg) {
				console.log('从news命名空间接收到send message事件，数据为：' + msg);
			});
		});


	</script>
</head>
<body>
</body>
</html>